Managed Ground Sdk
An GroundSdk session automatically managed according to an android Activity lifecycle.
This class allows the application to retrieve a GroundSdk session whose lifecycle is is automatically managed in correlation with a given Activity
's own lifecycle.This is the recommended way to use GroundSdk API in an android Activity.
The application should obtain such a session in the onCreate method. None of the session's lifecycle management methods, as described in GroundSdk documentation, need to be called.
- The session is automatically retained and restored upon configuration changes.
- The session is resumed when the activity calls through super.onStart() method (by default, but the application may chose to have it resumed in when the activity calls through super.onResume() method instead).
- The session is suspended when the activity calls through super.onStop() method (by default, but the application may chose to have it suspended in when the activity calls through super.onPause() method instead).
- The session is automatically closed when the activity calls through onDestroy. The application MUST NOT use the session past this point.
For example:
public class MyManagedGroundSdkActivity extends Activity {
private ManagedGroundSdk mGroundSdk;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mGroundSdk = ManagedGroundSdk.obtainSession(this);
}
@Override
public void onDestroy() {
super.onDestroy();
// mGroundSdk MUST NOT be used anymore past this point
}
}
Content copied to clipboard
Types
Link copied to clipboard
enum ObserverBehavior
Allows to specify when a managed GroundSdk session will resume/suspend its registered observers.
Functions
Link copied to clipboard
fun collectLogs(@NonNull sources: Collection<LogCollector.Source>, @NonNull outputArchive: File, @NonNull observer: Ref.Observer<LogCollector>): Ref<LogCollector>
Collects application &remote device debug logs.
Link copied to clipboard
Connects a drone identified by its uid.
Connects a drone identified by its uid using a specific connector.
fun connectDrone(@NonNull uid: String, @NonNull connector: DeviceConnector, @NonNull password: String): Boolean
Connects a secured drone identified by its uid.
Link copied to clipboard
fun connectRemoteControl(@NonNull uid: String, @NonNull connector: DeviceConnector, @NonNull password: String): Boolean
Connects a remote control identified by its uid.
Connects a remote control identified by its uid using a specific connector.
Link copied to clipboard
Disconnects a drone identified by its uid.
Link copied to clipboard
Disconnects a remote control identified by its uid.
Link copied to clipboard
Forgets a drone identified by its uid.
Link copied to clipboard
Forgets a remote control identified by its uid.
Link copied to clipboard
Retrieves currently discovered services.
Link copied to clipboard
fun getDroneList(@NonNull filter: Predicate<DroneListEntry>, @NonNull observer: Ref.Observer<List<DroneListEntry>>): Ref<List<DroneListEntry>>
Gets a list of known drones and registers an observer notified each time this list changes.
Link copied to clipboard
Link copied to clipboard
fun getRemoteControl(@NonNull uid: String, @NonNull listener: GroundSdk.OnDeviceRemovedListener): RemoteControl
Gets a remote control by uid.
Link copied to clipboard
fun getRemoteControlList(@NonNull filter: Predicate<RemoteControlListEntry>, @NonNull observer: Ref.Observer<List<RemoteControlListEntry>>): Ref<List<RemoteControlListEntry>>
Gets a list of known remote controls and registers an observer notified each time this list changes.
Link copied to clipboard
Commands GroundSDK to manage the given remote controller USB accessory.
Link copied to clipboard
Link copied to clipboard
open fun obtainSession(@NonNull activity: Activity, @NonNull observerBehavior: ManagedGroundSdk.ObserverBehavior): ManagedGroundSdk
Obtains a GroundSdk session automatically managed according to the provided activity's lifecycle.
Link copied to clipboard
fun replay(@NonNull source: FileReplay.Source, @NonNull observer: Ref.Observer<FileReplay>): Ref<FileReplay>
Creates a new replay stream for some local media file.